]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Use CLUTTER_CAIRO_FORMAT_ARGB32: rather then doing a byte order check
authorAdel Gadllah <adel.gadllah@gmail.com>
Wed, 13 Jul 2011 20:14:45 +0000 (22:14 +0200)
committerAdel Gadllah <adel.gadllah@gmail.com>
Wed, 13 Jul 2011 21:10:38 +0000 (23:10 +0200)
Clutter 1.7.x introduced CLUTTER_CAIRO_FORMAT_ARGB32: which can be used when
sharing textures/data with cairo without having to do check the
byte order and choose the appropriate format by hand.

https://bugzilla.gnome.org/show_bug.cgi?id=654577

configure.ac
src/shell-recorder.c
src/shell-xfixes-cursor.c
src/st/st-drawing-area.c
src/st/st-theme-node-drawing.c

index eb8098e8c91a2fba3c620916066793b834b96ce1..26f34345154f6248345ceb26af7acfc7cb6470e6 100644 (file)
@@ -64,7 +64,7 @@ fi
 
 AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
 
-CLUTTER_MIN_VERSION=1.5.15
+CLUTTER_MIN_VERSION=1.7.5
 GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
 GJS_MIN_VERSION=0.7.11
 MUTTER_MIN_VERSION=3.0.0
index d297923e014456b23425b8c021de0d465ef77516..0171045de527a88b5771f032009397e8a09b99e9 100644 (file)
@@ -198,7 +198,7 @@ create_recording_icon (void)
 
   texture = cogl_texture_new_from_data (32, 32,
                                         COGL_TEXTURE_NONE,
-                                        COGL_PIXEL_FORMAT_BGRA_8888,
+                                        CLUTTER_CAIRO_FORMAT_ARGB32,
                                         COGL_PIXEL_FORMAT_ANY,
                                         cairo_image_surface_get_stride (surface),
                                         cairo_image_surface_get_data (surface));
@@ -529,7 +529,7 @@ recorder_record_frame (ShellRecorder *recorder)
   cogl_read_pixels (0, 0,
                     recorder->stage_width, recorder->stage_height,
                     COGL_READ_PIXELS_COLOR_BUFFER,
-                    COGL_PIXEL_FORMAT_BGRA_8888_PRE,
+                    CLUTTER_CAIRO_FORMAT_ARGB32,
                     data);
 
   recorder_draw_cursor (recorder, buffer);
index 334503df9aaa231d734f0631d5164f8de2ca457e..0da2397c666e6e5ebd0b8683c1f801e6b3f6eca1 100644 (file)
@@ -232,11 +232,7 @@ xfixes_cursor_reset_image (ShellXFixesCursor *xfixes_cursor)
   sprite = cogl_texture_new_from_data (cursor_image->width,
                                        cursor_image->height,
                                        COGL_TEXTURE_NONE,
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                                       COGL_PIXEL_FORMAT_BGRA_8888_PRE,
-#else
-                                       COGL_PIXEL_FORMAT_ARGB_8888_PRE,
-#endif
+                                       CLUTTER_CAIRO_FORMAT_ARGB32,
                                        COGL_PIXEL_FORMAT_ANY,
                                        cursor_image->width * 4, /* stride */
                                        cursor_data);
index 2235842d8081866f8b77c8e02ac77461aed3445f..2b904e219c5b558a9eff81c146caba18d37f6a20 100644 (file)
 
 #include <cairo.h>
 
-/* Cairo stores the data in native byte order as ARGB but Cogl's pixel
-   formats specify the actual byte order. Therefore we need to use a
-   different format depending on the architecture */
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define PIXEL_FORMAT COGL_PIXEL_FORMAT_BGRA_8888_PRE
-#else
-#define PIXEL_FORMAT COGL_PIXEL_FORMAT_ARGB_8888_PRE
-#endif
-
 G_DEFINE_TYPE(StDrawingArea, st_drawing_area, ST_TYPE_WIDGET);
 
 struct _StDrawingAreaPrivate {
@@ -122,7 +113,7 @@ st_drawing_area_paint (ClutterActor *self)
         {
           priv->texture = cogl_texture_new_with_size (width, height,
                                                       COGL_TEXTURE_NONE,
-                                                      PIXEL_FORMAT);
+                                                      CLUTTER_CAIRO_FORMAT_ARGB32);
           priv->needs_repaint = TRUE;
         }
 
@@ -142,7 +133,7 @@ st_drawing_area_paint (ClutterActor *self)
           priv->context = NULL;
 
           cogl_texture_set_region (priv->texture, 0, 0, 0, 0, width, height, width, height,
-                                   PIXEL_FORMAT,
+                                   CLUTTER_CAIRO_FORMAT_ARGB32,
                                    cairo_image_surface_get_stride (surface),
                                    cairo_image_surface_get_data (surface));
 
index a600179a45597c79875125cef1225777f92da061..7513a48f9ca3497aacfde82b88cd129ff90cf7ee 100644 (file)
@@ -167,11 +167,7 @@ create_corner_material (StCornerSpec *corner)
 
   texture = cogl_texture_new_from_data (size, size,
                                         COGL_TEXTURE_NONE,
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                                        COGL_PIXEL_FORMAT_BGRA_8888_PRE,
-#else
-                                        COGL_PIXEL_FORMAT_ARGB_8888_PRE,
-#endif
+                                        CLUTTER_CAIRO_FORMAT_ARGB32,
                                         COGL_PIXEL_FORMAT_ANY,
                                         rowstride,
                                         data);
@@ -1250,14 +1246,7 @@ st_theme_node_prerender_background (StThemeNode *node)
   texture = cogl_texture_new_from_data (paint_box.x2 - paint_box.x1,
                                         paint_box.y2 - paint_box.y1,
                                         COGL_TEXTURE_NONE,
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-                                        COGL_PIXEL_FORMAT_BGRA_8888_PRE,
-#elif G_BYTE_ORDER == G_BIG_ENDIAN
-                                        COGL_PIXEL_FORMAT_ARGB_8888_PRE,
-#else
-                                        COGL_PIXEL_FORMAT_ANY,
-#error unknown endianness type
-#endif
+                                        CLUTTER_CAIRO_FORMAT_ARGB32,
                                         COGL_PIXEL_FORMAT_ANY,
                                         rowstride,
                                         data);